package com.example.demo.chat_room.mongodb_domain;

import lombok.Data;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.util.List;

// 将这个类转成文档,并指定文档放入哪个集合
@Data
@Document("test")
public class User {
//    @Id
    private int uid;
    private String name;
    private int age;
    // 让这个属性在编译进文档时改名为likes
    @Field("likes")
    private List<String> like;
    private List<String> array;

    // 表示这个属性不会被编译进文档中
    @Transient
    private int noAdd;

    public User(int uid, String name, int age, List<String> like, List<String> array, int noAdd) {
        this.uid = uid;
        this.name = name;
        this.age = age;
        this.like = like;
        this.array = array;
        this.noAdd = noAdd;
    }

    public User() {
    }

}
